home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / pbaseiv.zip / P4DOS005.TIP < prev    next >
Text File  |  1991-12-16  |  2KB  |  52 lines

  1. I use UNIX as well as DOS, and I prefer its "rm" (remove)
  2. command to DOS's DEL and ERASE as a way of deleting files.
  3. "rm" lets you delete many files by specifying them all in
  4. one command line, e.g. "rm fhm.* *.doc *.dat test.drw
  5. *.dwg"--something DEL could never dream of. To bring this
  6. old UNIX friend into the DOS world, I developed a batch
  7. file, RM.BAT [see listing]. Put this file in a directory on
  8. your path, and you can delete up to nine files or wild-card
  9. file groups. Note that if you're using an earlier version of
  10. DOS than 3.1, you need to remove the @ sign at the beginning
  11. of the `Echo off' command in this file.
  12.  
  13. Faheem Ahmad
  14. Blacksburg, Virginia
  15.  
  16. Editor's note: This batch file is an excellent demonstration
  17. of the DOS SHIFT command, which "steps" through a list of
  18. batch file arguments so %2 becomes %1 and %3 becomes %2,
  19. etc. This allows you to process many parameters in a loop.
  20. The OS/2 shell's ERASE and DEL commands already allow
  21. multiple file specs, but Microsoft hasn't added them to DOS
  22. for fear of creating incompatibilities. To extract this
  23. batch file for your own use, use the Alt-F command, sending
  24. the listing to a file called RM.BAT in a directory on your
  25. path.
  26.  
  27. RM.BAT
  28.  
  29. ---- BEGIN LISTING ----
  30. @echo off
  31. if "%1"=="" goto MSG
  32. if "%1"=="/?" goto MSG
  33. :START
  34. if "%1"=="" goto END
  35. erase  %1
  36. shift
  37. goto START
  38. :MSG
  39. echo Deletes the files listed
  40. echo on the command line.
  41. echo Wildcards are allowed.
  42. echo RM file [file [file...]]
  43. :END
  44. @echo on
  45. ---- END LISTING ----
  46.  
  47. Title: Delete Tall Heaps of Files in a Single Bound
  48. Category: DOS
  49. Issue date: Aug 1991
  50. Editor: Brett Glass
  51. Supplementary files: NONE
  52.